#include <iostream>
#include <array>

using namespace std;

template <typename T>
array<T, 3> order(const array<T, 3> arr)
{
    array<T, 3> ordered;
    for (int i=0; i<3; i++)
    {
        ordered[i] = arr[i];
    }
    if (ordered[1] < ordered[0])
    {
        T a = ordered[0];
        ordered[0] = ordered[1];
        ordered[1] = a;
    }
    if (ordered[2] < ordered[1])
    {
        T a = ordered[1];
        ordered[1] = ordered[2];
        ordered[2] = a;
    }
    if (ordered[1] < ordered[0])
    {
        T a = ordered[0];
        ordered[0] = ordered[1];
        ordered[1] = a;
    }
    return ordered;
}

template <typename T>
void displayArray(array<T, 3> arr)
{
    cout << "[";
    for (int i=0; i<3; i++)
    {
        cout << arr[i];
        if (i < 2)
        {
            cout << ",";
        }
    }
    cout << "]";
    cout << endl;
}

int main()
{
    double a=23.5, b=2.0, c=-203.4;
    array<double, 3> arr = {a, b, c};
    displayArray(order(arr));
    array<string, 3> arr2 = {"put", "hello", "got"};
    displayArray(order(arr2));
}